
import axios from 'axios'
import bcrypt from 'bcryptjs'
import qs from 'qs'

export function generaterToken () {
    let time = new Date()
    let host = window.location.host
    let string = 'mojo' + Math.round(time/3600) + host
    let salt = bcrypt.genSaltSync(10);
    let fuck = bcrypt.hashSync(string, salt);
    return fuck;
}

export let api = axios.create({
    baseURL: 'http://www.trytv.org/',
    timeout: 5000,
    //headers: {'X-Custom-Header': 'foobar'}
    //withCredentials: true,
    // transformRequest: [function (data, headers) {
    //     // Do whatever you want to transform the data
    //
    //     return qs.stringify(data);
    // }],

});
//api.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

//api.defaults.headers.common['Authorization'] = generaterToken();

